//
//  GKBookTableCell.swift
//  MySwiftObject
//
//  Created by wangws1990 on 2019/9/23.
//  Copyright © 2019 wangws1990. All rights reserved.
//

import UIKit

class GKBookTableCell: UICollectionViewCell {

    @IBOutlet weak var favBtn: UIButton!
    @IBOutlet weak var countLab: UILabel!
    @IBOutlet weak var nickNameLab: UILabel!
    @IBOutlet weak var contentLab: UILabel!
    @IBOutlet weak var titleLab: UILabel!
    @IBOutlet weak var stateBtn: UIButton!
    @IBOutlet weak var imageV: UIImageView!
    
    
    var _model : GKBookModel!;
    var model:GKBookModel{
        set{
            _model = newValue;
            self.imageV.setGkImageWithURL(url: _model.cover  ?? "");
            self.titleLab.text = _model.title ?? "";
            self.contentLab.text = _model.shortIntro ?? "";
            self.nickNameLab.text = _model.author ?? "";
            self.countLab.text = GKNumber.getCount(count: _model.latelyFollower ?? 0);
            self.stateBtn.setTitle(_model.majorCate ?? "", for: .normal);
            self.stateBtn.isHidden = (_model.majorCate != nil) ? false : true;
            self.favBtn.setTitle("关注:"+String(_model.retentionRatio)+("%"), for: .normal);
        }get{
            return _model;
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        self.stateBtn.layer.masksToBounds = true;
        self.stateBtn.layer.cornerRadius = 7.5;
        self.favBtn.layer.masksToBounds = true;
        self.favBtn.layer.cornerRadius = 10;
        
        self.imageV.layer.masksToBounds = true;
        self.imageV.layer.cornerRadius = AppRadius
        // Initialization code
    }

}
